// import accMul from './accMul'
const price = {
  money(num) {
    var str = '';
    if (Math.abs(num) >= 100000000) {
      str = Math.round((num / 100000000) * 100) / 100;
      return str;
    }
    if (Math.abs(num) > 10000 && Math.abs(num) < 100000000) {
      str = Math.round((num / 10000) * 100) / 100;
      return str;
    }

    return Math.round(num * 100) / 100;
  },
  unit(num) {
    if (Math.abs(num) >= 100000000) {
      return '亿元';
    }
    if (Math.abs(num) > 10000 && Math.abs(num) < 100000000) {
      return '万元';
    }

    return '元';
  },
  unitY(num) {
    if (Math.abs(num) >= 100000000) {
      return '  单位：亿元  ';
    }
    if (Math.abs(num) > 10000 && Math.abs(num) < 100000000) {
      return '  单位：万元  ';
    }

    return '  单位： 元';
  },
  filterTime(time, type) {
    if (type != 5) {
      var arr = time.split('-');
    }
    var str = '';
    if (type == 1) {
      str = arr[0] + '年' + arr[1] + '月' + arr[2] + '日';
    }
    if (type == 2) {
      str = arr[0] + '年' + '第' + arr[1] + '周';
    }
    if (type == 3) {
      str = arr[0] + '年' + arr[1] + '月';
    }
    if (type == 5) {
      str = time + '年';
    }
    if (type == 4) {
      str = arr[0] + '年' + '第' + arr[1] + '季度';
    }
    return str;
  },
  shareText(time, type, key, val, unit, enterpriseName) {
    let str = {
      title: enterpriseName + this.filterTime(time, type) + '分析数据',
      desc: enterpriseName + this.filterTime(time, type) + key + val + unit,
    };
    return str;
  },
  // 四舍五入
  mathRound(val) {
    return Math.round(val * 100) / 100;
  },
};
export default price;
